<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title> - 空白页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">


    <link rel="shortcut icon" href="favicon.ico"> <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css?v=4.1.0" rel="stylesheet">

    <!--- 引入的phpMyAdmin样式 -->
    <!-- <link href="css/print.css" rel="stylesheet"> -->
    <!-- <link href="css/jquery-ui-1.8.16.custom.css" rel="stylesheet"> -->

    <link href="css/plugins/iCheck/custom.css" rel="stylesheet">
</head>

<body class="gray-bg">
    <div class="col-sm-13">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>数据表列表</h5>
                <div class="ibox-tools">
                    <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                    <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
                    <i class="fa fa-wrench"></i></a>
                    <a class="close-link"><i class="fa fa-times"></i></a>
                </div>
            </div>
            <div class="ibox-content">
                <a href="?r=" id="user-index" class="btn btn-info dropdown-toggle J_menuItem">创建表</a>
            </div>
        </div>
    </div>
<style type="text/css">
    #dbname tr td i{
        cursor: pointer;
        margin: 5px;
    }
</style>
<div class="ibox-content">
    <input type="hidden" class="k" value="<?= $k;?>">
    <table class="table">
        <thead>
            <tr>
                <th width="25"></th>
                <th width="120">表名称</th>
                <th width="80">表注释</th>
                <th width="80">引擎</th>
                <th width="120">字符类型</th>
                <th width="120">操作</th>
            </tr>
        </thead>
        <tbody id="dbname">
        <?php foreach($table as $key => $val): ?>
            <tr>
                <td><input type="checkbox" value="" name=""></td>
                <td class="text-l"><?php echo $val['TABLE_NAME']?></td>
                <td><?php echo $val['TABLE_COMMENT']?></td>
                <td><?php echo $val['ENGINE']?></td>
                <td><?php echo $val['TABLE_COLLATION']?></td>
                <td>
                    <i class="glyphicon glyphicon-trash tablenames" data-tablenames="<?= $val['TABLE_NAME'];?>"></i>
                    <a href="?r=tables/tables_names&table="><i class="glyphicon glyphicon-list"></i></a>
                </td>
            </tr>
        <?php endforeach;?>
        </tbody>
    </table>
</div>

    
    <!-- 全局js -->
    <script src="js/jquery.min.js?v=2.1.4"></script>
    <script src="js/bootstrap.min.js?v=3.3.6"></script>
    <!-- 自定义js -->
    <script src="js/content.js?v=1.0.0"></script>
    <script src="js/plugins/iCheck/icheck.min.js"></script>
    <script src="js/demo/peity-demo.js"></script>
    <!-- Peity -->
    <script src="js/plugins/peity/jquery.peity.min.js"></script>
</body>
</html>
<script type="text/javascript">
    $(".tablenames").click(function(){
        var tablenames = $(this).data("tablenames"); //要删除的数据表名称
        var dbname = $(this).data("dbname"); //当前数据表所属的数据库名称
        if(confirm("确认要删除"+tablenames+"表吗?")){
            var k = $(".k").val();
            var _this = $(this);
            $.ajax({
                type: "post",
                url: "?r=tables/del_table",
                data: {'tablenames':tablenames, 'k':k, 'dbname':dbname},
                dataType: "json",
                success:function(msg){
                    if(msg === '1'){
                        _this.parent().parent().remove();
                    }
                }
            });
        }
    })
    function checkSubmit(){
        var dbname_u = document.getElementById("dbname_u").value;
        var charset_u = document.getElementById("charset_u").value;
        if(dbname_u === '' || charset_u === '0'){
            alert('请将必填的数据填写完整');
            return false;
        }else{
            return true;
        }
    }
</script>